{% extends 'common/internal_page.html' %}
{% load playlists_extras %}

{% block extrastyle %}
<link rel="stylesheet" href="/media/playlists/playlists.css" />
{% endblock %}

{% block extrahead %}
<script type="text/javascript" 
    src="/media/common/js/jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" 
    src="/media/common/js/jquery-autocomplete/jquery.autocomplete.js"></script>
<script type="text/javascript" 
    src="/media/common/js/chirp/chirp.js"></script>
<script type="text/javascript" 
    src="/media/playlists/js/playlists.js"></script>
{% endblock %}

{% block content %}
<div id="playlist"> <!-- site wrapper -->
  <div id="form-column"> <!-- form column -->
    <form method="post" id="playlist-form" action="{% url playlists_add_event %}">
      <fieldset>
  {% if not request.is_from_studio %}
        <ul class="errorlist">
          <li>WARNING! You are not in the studio, you sure you want to modify this playlist?
          <button name="is_from_studio_override">Yes, I know, don't bug me.</button></li>
        </ul>
  {% endif %}

        <div id="played_warning" style="display: none">
        </div>

  {% if not add_break %}
{{ form.artist.errors }}
  {% endif %}
        <label for="artist">Artist</label>
{{ form.artist }}
{{ form.artist_key }}

  {% if not add_break %}
{{ form.song.errors }}
  {% endif %}
        <label for="song">Song Title</label>
{{ form.song }}
{{ form.song_key }}

  {% if not add_break %}
{{ form.album.errors }}
  {% endif %}
        <label for="album">Album</label>
{{ form.album }}
{{ form.album_key }}

  {% if not add_break %}
{{ form.label.errors }}
  {% endif %}
        <label for="label">Label</label>
{{ form.label }}
        <label for="category">Category</label>
        <div class="category">
          <div class="tracks_heavy_rotation">{{ form.is_heavy_rotation }} Heavy rotation</div>
          <div class="tracks_light_rotation">{{ form.is_light_rotation }} Light rotation</div><br/>
          <div class="tracks_local_current">{{ form.is_local_current }} Local current</div>
          <div class="tracks_local_classic">{{ form.is_local_classic }} Local classic</div>
        </div>
  {% if not add_break %}
{{ form.song_notes.errors }}
  {% endif %}
        <label for="song_notes">Song Notes</label>
{{ form.song_notes }}

        <input type="submit" class="button" name="submit" value="Submit" />
        <input type="submit" class="button" name="submit" value="Add Break" />
<!--<input type="submit" class="button" name="populate" value="Fill form via Traktor" />-->

        <ul>
          <li><a id="lookup-on-musicbrainz" href="http://musicbrainz.org/search/textsearch.html" target="_blank">Look this song or album up on MusicBrainz</a></li>
          <li><a id="lookup-album-on-google" href="http://google.com/search" target="_blank">Search for this album on Google</a></li>
          <li><a id="pronounce-artist" href="http://google.com/search" target="_blank">See how to pronounce artist name</a></li>
        </ul>
      </fieldset>
    </form>
  </div> <!-- end form column -->

  <div id="playlist-column"> <!-- playlist column -->
    <input name="id_allow_receive" id="id_allow_receive" type="checkbox" checked="true"/> Allow receiving from DJ database
    <div class="tracks_played">
Tracks played since {{ last_dt|date:"P" }}:<br/>
      <div class="tracks_heavy_rotation" title="Heavy Rotation">{{ quotas.heavy_rotation_played }} / {{ quotas.heavy_rotation_target }}</div>
      <div class="tracks_light_rotation" title="Light Rotation">{{ quotas.light_rotation_played }} / {{ quotas.light_rotation_target }}</div>
      <div class="tracks_local_current" title="Local Current">{{ quotas.local_current_played }} / {{ quotas.local_current_target }}</div>
      <div class="tracks_local_classic" title="Local Classic">{{ quotas.local_classic_played }} / {{ quotas.local_classic_target }}</div>
    </div>

    <h2>Artist &bull; Song Title &bull; Album &bull; Label</h2>

  {% if playlist_events %}
    {% for event in playlist_events %}
      {% if event.is_break %}
    <p class="break">Break</p>  
      {% else %}
    <div class="song-info {% if event.is_new %}new{% endif %}"> <!-- song information container -->
      <p class="time">{{ event.established_display|time:"g:i A" }}</p>
        {% if 'heavy_rotation' in event.categories %}
      <div class="tracks_heavy_rotation">Heavy Rotation</div>
        {% endif %}
        {% if 'light_rotation' in event.categories %}
      <div class="tracks_light_rotation">Light Rotation</div>
        {% endif %}
        {% if 'local_current' in event.categories %}
      <div class="tracks_local_current">Local Current</div>
        {% endif %}
        {% if 'local_classic' in event.categories %}
      <div class="tracks_local_classic">Local Classic</div>
        {% endif %}

      <p>
        <span class="artist">{{ event.artist_name }}</span> 
        &bull; <span class="song">{{ event.track_title }}</span> 
        &bull; <span class="album">{{ event.album_title_display }}</span>
        &bull; <span class="label">{{ event.label_display }}</span>
      </p>

        {% if event.notes %}
      <p class="notes"><strong>Notes:</strong> {{ event.notes }}</p>
        {% endif %}

        {% ifequal event.selector.key user.key %}
      <p class="playlist-event-management">
        <a title="Delete this entry" href="{% url playlists_delete_event event.key %}">[delete]</a>
      </p>
        {% endifequal %}
    </div>
      {% endif %}
    {% endfor %}
  {% else %}
    <p>No tracks have been played within the last three hours.</p>
  {% endif %}

{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">1:12 PM</p> #}
{# <p><span class="artist">The Jam</span> &bull; <span class="song">New of the World</span> &bull; <span class="album">In The City</span> &bull; <span class="label">Polydor</span></p> #}
{# <p class="notes"><strong>Notes:</strong> Touring sans Paul Weller. Show Tuesday at Beat Kitchen.</p> #}
{# </div> #}
{#  #}
{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">1:08 PM</p> #}
{# <p><span class="artist">The Clash</span> &bull; <span class="song">Brand New Cadillac</span> &bull; <span class="album">London Calling</span> &bull; <span class="label">Epic</span></p> #}
{# </div> #}
{#  #}
{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">1:04 PM</p> #}
{# <p><span class="artist">The Beach Boys</span> &bull; <span class="song">I'm Waiting For The Day</span> &bull; <span class="album">Pet Sounds</span> &bull; <span class="label">Capital</span></p> #}
{# <p class="notes"><strong>Notes:</strong> News of Brian Wilson's death were greatly exagerated.</p> #}
{# </div> #}
{#  #}
{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">12:59 PM</p> #}
{# <p><span class="artist">Nirvana</span> &bull; <span class="song">In Bloom</span> &bull; <span class="album">Nevermind</span> &bull; <span class="label">DGC</span></p> #}
{# </div> #}
{#  #}
{# <p class="break">Break</p> #}
{#  #}
{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">12:50 PM</p> #}
{# <p><span class="artist">Radiohead</span> &bull; <span class="song">Bodysnatchers</span> &bull; <span class="album">In Rainbows</span> &bull; <span class="label">XL</span></p> #}
{# </div> #}
{#  #}
{# <div class="song-info"> <!-- song information container --> #}
{# <p class="time">12:47 PM</p> #}
{# <p><span class="artist">Portishead</span> &bull; <span class="song">Hunter</span> &bull; <span class="album">Silence</span> &bull; <span class="label">Mercury</span></p> #}
{# </div> #}

    <p class="links"><a href="http://chirpradio.org/">CHIRPradio.org</a> &bull; <a href="http://chicagoindieradio.org/">CHIRP Website</a></p>
  </div> <!-- end playlist column -->
</div> <!-- end site wrapper -->    
{% endblock %}

